<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class post extends CI_Controller {
	public function __construct(){
		parent::__construct();
		$this->load->model(array('post_model', 'kategori_model'));
	}

	public function index(){
		redirect(site_url());
	}

	public function show($bln="", $tgl="", $id="", $permalink=""){
		if(!empty($bln) && !empty($tgl) && !empty($id) && !empty($permalink)){
			if(is_numeric($bln) && is_numeric($tgl) && is_numeric($id)){
				$data['post'] = $this->post_model->single($id, $permalink);
				$data['title'] = "Jogja Nuws";
				$data['desc'] = $data['post'][0]['jonu_post_title'];
				$data['category'] = $this->kategori_model->get_all();
				$data['recommend_post'] = $this->post_model->get_all_rand();

				$this->load->view('single', $data);
			}else{
				redirect(site_url());			
			}
		}else{
			redirect(site_url());
		}
	}
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */